import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// main.js
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import axios from 'axios'
// 引入element-tiptap
import { ElementTiptapPlugin } from 'element-tiptap';
// import element-tiptap 样式
import 'element-tiptap/lib/index.css';
// 使用富文本编辑器
Vue.use(ElementTiptapPlugin,{
  lang: 'zh',
});

Vue.prototype.axios = axios
Vue.use(ElementUI);

Vue.config.productionTip = false


axios.interceptors.request.use(function (config) {
  // 在发送请求前向header添加jwt
  let jwt = localStorage.getItem('JWT_TOKEN')
  if (jwt!=null){
    config.headers['Authorization'] = jwt;
  }
  return config;
},function (error) {
  return Promise.reject(error);
});

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
